home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_01_07 / 1n07011a < prev    next >
Text File  |  1990-10-01  |  307b  |  18 lines

  1. // Print value of n
  2.  
  3. void pdec(int n)
  4. {
  5.     if (n < 0)            // if negative,
  6.     {
  7.         putchar ('-');    // print - sign
  8.         pdec(-n);        // and abs value
  9.     }
  10.     else
  11.     {
  12.         if (n > 9)            // if more than 1 digit,
  13.             pdec(n/10);        // print all but last digit...
  14.         
  15.         putchar(n % 10 + '0');        // print last digit.
  16.     }
  17. }
  18.